From: akw27@arcadians.cl.cam.ac.uk Date: Mon, 14 Mar 2005 09:03:44 +0000 (+0000) Subject: bitkeeper revision 1.1236.30.2 (423553705lFIxda6xBfLOruUqofkAQ) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~17857^2~26^2~2^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a44d3598295fdd2fc742bb7b36695f82ddb77c36;p=xen.git bitkeeper revision 1.1236.30.2 (423553705lFIxda6xBfLOruUqofkAQ) xcs control channel cleanup fixes from rick cox. Signed-off-by: andrew.warfield@cl.cam.ac.uk --- diff --git a/tools/xcs/xcs.c b/tools/xcs/xcs.c index 8539d20dfc..08085d4352 100644 --- a/tools/xcs/xcs.c +++ b/tools/xcs/xcs.c @@ -97,7 +97,7 @@ static void map_dom_to_port(u32 dom, int port) exit(1); } - for (; dom_port_map_size < dom + 10; dom_port_map_size++) { + for (; dom_port_map_size < dom + 256; dom_port_map_size++) { dom_port_map[dom_port_map_size] = -1; } } @@ -123,7 +123,7 @@ static control_channel_t *add_interface(u32 dom, int local_port, control_channel_t *cc=NULL, *oldcc; int ret; - if (cc_list[dom_to_port(dom)] != NULL) + if ((dom_to_port(dom) >= 0) && (cc_list[dom_to_port(dom)] != NULL)) { return(cc_list[dom_to_port(dom)]); } @@ -155,10 +155,13 @@ static control_channel_t *add_interface(u32 dom, int local_port, if ((oldcc->remote_dom != cc->remote_dom) || (oldcc->remote_port != cc->remote_port)) { - DPRINTF("CC conflict! (port: %d, old dom: %u, new dom: %u)\n", - cc->local_port, oldcc->remote_dom, cc->remote_dom); + DPRINTF("CC conflict! (port: %d, old dom: %u, new dom: %u, " + "old ref_count: %d)\n", + cc->local_port, oldcc->remote_dom, cc->remote_dom, + oldcc->ref_count); map_dom_to_port(oldcc->remote_dom, -1); ctrl_chan_free(cc_list[cc->local_port]); + cc_list[cc->local_port] = NULL; } } @@ -210,6 +213,8 @@ void put_interface(control_channel_t *cc) { DPRINTF("Freeing cc on port %d.\n", cc->local_port); (void)evtchn_unbind(cc->local_port); + cc_list[cc->local_port] = NULL; + map_dom_to_port(cc->remote_dom, -1); ctrl_chan_free(cc); } }